﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.AssetManage;
using LJX.SmartPark.Domain.IotInfo.LightPoles;
using LJX.SmartPark.Service.AssetManage;
using LJX.SmartPark.Service.IotInfo.LightPoles;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static LJX.SmartPark.Service.AssetManage.EquipmentLedgerServeice;

namespace LJX.SmartPark.WebApi.Controllers.AssetManage
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "AssetManage")]
    public class EquipmentLedgerController : ControllerBase
    {
        private readonly IEquipmentLedgerServeice _equipmentLedgerService;

        public EquipmentLedgerController(IEquipmentLedgerServeice equipmentLedgerService)
        {
            _equipmentLedgerService = equipmentLedgerService;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> PostAddEquipmentLedger(EquipmentLedger input)
        {
            var result = _equipmentLedgerService.PostAddEquipmentLedgerAsync(input);
            return result;
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        [HttpDelete]
        public Task<Response<bool>> DeleteEquipmentLedger(EquipmentLedger input)
        {
            var result = _equipmentLedgerService.DeleteEquipmentLedgerAsync(input);
            return result;
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutUpdateEquipmentLedger(EquipmentLedger input)
        {
            var result = _equipmentLedgerService.PutUpdEquipmentLedgerAsync(input);

            return result;

        }

        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _equipmentLedgerService.GetCount();
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<EquipmentLedger>> GetEquipmentLedgerAsync(FyEquipmentLedger fyEquipmentLedger)
        {
            var result = _equipmentLedgerService.GetEquipmentLedgerAsync(fyEquipmentLedger);
            return result.Result;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<EquipmentLedger> GetEquipmentLedgerById(EquipmentLedger input)
        {
            var result = _equipmentLedgerService.GetEquipmentLedgerById(input);
            return result;
        }
    }
}
